<template>
  <el-tabs v-model="activeName" @tab-click="handleClick"> 
    <el-tab-pane label="基本信息" name="first">
      <div class="button">
        <el-button type="success" size="mini" @click="reviseinfo(formInfo)" v-show="reviseBtn">保存</el-button>
      </div>
      <el-tag color="#E6A23C" v-show="info_status == 1" effect="dark">未审核</el-tag>
      <el-tag color="#77AE1C" v-show="info_status == 2" effect="dark">审核成功</el-tag>
      <el-tag color="red" v-show="info_status == 3" effect="dark">审核失败</el-tag>
      <!-- <router-link :to="{path:'/home/user/load',query:{item:this.id}}">下载个人所有信息</router-link> -->
      <el-button type="success" v-show="info_status == 2" style="float:right;">
        <a :href="'http://localhost/cultivate/php/uploads/html/downloadPersonInfo.html?item=' + id">下载个人所有信息</a>
      </el-button>
      <table border="1px" cellspacing="0" cellpadding="0" class="table">
        <tr>
          <td bgcolor="#90D0FC">姓名</td>
          <td><el-input v-model="formInfo.name" :disabled="true" placeholder=""></el-input></td>
          <td bgcolor="#90D0FC">性别</td>
          <td>
            <el-radio-group v-model="formInfo.sex">
              <el-radio :label="1">男</el-radio>
              <el-radio :label="2">女</el-radio>
            </el-radio-group>
          </td>
          <td bgcolor="#90D0FC">出生日期</td>
          <td>
            <el-date-picker
            v-model="formInfo.birth"
            type="date"
            value-format="yyyy:MM:dd"
            placeholder="选择日期">
            </el-date-picker>
          </td>
          <td bgcolor="#90D0FC">民族</td>
          <td>
            <el-select v-model="formInfo.nation" placeholder="请选择">
              <el-option value="汉族">汉族</el-option>
              <el-option value="少数民族">少数民族</el-option>
            </el-select>
          </td>
<!--           <td rowspan="5" width="100px">照片</td> -->
        </tr>
        <tr>
          <td bgcolor="#90D0FC">政治面貌</td>
          <td>
            <el-select v-model="formInfo.politics" placeholder="请选择">
              <el-option
                v-for="item in politicsList"
                :key="item.value"
                :label="item.label"
                :value="item.value">
              </el-option>
            </el-select>
          </td>
          <td bgcolor="#90D0FC">身份证号</td>
          <td><el-input v-model="formInfo.idnumber" :disabled="true"></el-input></td>
          <td bgcolor="#90D0FC">工作单位</td>
          <td><el-input v-model="formInfo.sch" placeholder="请输入内容"></el-input></td>
          <td bgcolor="#90D0FC">行政职务</td>
          <td><el-input v-model="formInfo.preoccupation" placeholder="请输入内容"></el-input></td>
        </tr>
        <tr>
          <td bgcolor="#90D0FC">专业技术职务</td>
          <td><el-input v-model="formInfo.majoroccupation" placeholder="请输入内容"></el-input></td>
          <td bgcolor="#90D0FC">参加工作时间</td>
          <td>
            <el-date-picker
            v-model="formInfo.majortime"
            type="date"
            value-format="yyyy:MM:dd"
            placeholder="选择日期">
            </el-date-picker>
          </td>
          <td bgcolor="#90D0FC">职务级别</td>
          <td><el-input v-model="formInfo.jobrank" placeholder="请输入内容"></el-input></td>
          <td bgcolor="#90D0FC">最高学历</td>
          <td>
            <el-select v-model="formInfo.edu" placeholder="请选择">
              <el-option
                v-for="item in eduAll"
                :key="item.value"
                :label="item.label"
                :value="item.value">
              </el-option>
            </el-select>
          </td>
        </tr>
        <tr>
          <td bgcolor="#90D0FC">最后学位</td>
          <td>
            <el-select v-model="formInfo.degree" placeholder="请选择">
              <el-option
                v-for="item in degreeAll"
                :key="item.value"
                :label="item.label"
                :value="item.value">
              </el-option>
            </el-select>
          </td>
          <td bgcolor="#90D0FC">通讯地址</td>
          <td><el-input v-model="formInfo.address" placeholder="请输入内容"></el-input></td>
          <td bgcolor="#90D0FC">邮政编码</td>
          <td><el-input v-model="formInfo.postalcode" placeholder="请输入内容"></el-input></td>
          <td bgcolor="#90D0FC">办公电话</td>
          <td><el-input v-model="formInfo.office" placeholder="请输入内容"></el-input></td>
        </tr>
        <tr>
          <td bgcolor="#90D0FC">手机</td>
          <td><el-input v-model="formInfo.phone" placeholder="请输入内容"></el-input></td>
          <td bgcolor="#90D0FC">qq号</td>
          <td><el-input v-model="formInfo.qq" placeholder="请输入内容"></el-input></td>
          <td bgcolor="#90D0FC">电子信箱</td>
          <td><el-input v-model="formInfo.email" placeholder=""></el-input></td>
           <td bgcolor="#90D0FC">传真</td>
          <td><el-input v-model="formInfo.fax" placeholder=""></el-input></td>
        </tr>
      </table>
    </el-tab-pane>
    <el-tab-pane label="工作经历" name="second">
      <div class="button"  v-show="showbutton">
        <el-button type="success" size="mini" v-show="showEdit==false" @click="submitexwork(exwork)">保存</el-button>
        <el-button type="success" size="mini" v-show="showEdit" @click="exworkRevise(exwork)">修改</el-button>
      </div>
      <table border="1px" cellspacing="0" cellpadding="0" class="table"  v-show="showbutton">
        <tr>
          <td bgcolor="#90D0FC">工作单位</td>
          <td><el-input v-model="exwork.work" placeholder="请输入内容"></el-input></td>
          <td bgcolor="#90D0FC">职务</td>
          <td><el-input v-model="exwork.preoccupation" placeholder="请输入内容"></el-input></td>
          <td bgcolor="#90D0FC">开始时间</td>
          <td>
            <el-date-picker
            v-model="exwork.start_time"
            type="date"
            placeholder="选择日期"
            value-format="yyyy-MM-dd">
            </el-date-picker>
          </td>
          <td bgcolor="#90D0FC">结束时间</td>
          <td>
            <el-date-picker
            v-model="exwork.end_time"
            type="date"
            placeholder="选择日期"
            value-format="yyyy-MM-dd">
            </el-date-picker>
          </td>
        </tr>
      </table>
        <h1 class="item">我的工作经历</h1>
        <el-button class="item" @click="exwork_showTable()">添加工作经历</el-button>
        <el-table
        :data="exworktableData"
        stripe
        style="width: 100%">
          <el-table-column
          prop="work"
          label="工作单位"
          width="180">
          </el-table-column>
          <el-table-column
          prop="preoccupation"
          label="职务"
          width="180">
          </el-table-column>
          <el-table-column
          prop="start_time"
          label="开始时间"
          value-format="yyyy-MM-dd">
          </el-table-column>
          <el-table-column
          prop="end_time"
          label="结束时间"
          value-format="yyyy-MM-dd">
          </el-table-column>
          <el-table-column label="操作">
            <template slot-scope="scope">
              <el-button
              size="mini"
              @click="exwork_handleEdit(scope.row)">修改</el-button>
              <el-button
                  v-popover:popover5
                  size="mini"
                  type="danger"
                  @click="exwork_delete(scope.row)"
                >删除</el-button>
            </template>
          </el-table-column>
        </el-table>
      </el-tab-pane>
      <el-tab-pane label="教育经历" name="third">
      <div class="button" v-show="showbutton">
        <el-button type="success" size="mini" v-show="showEdit==false" @click="submitexedu(exedu)">保存</el-button>
        <el-button type="success" size="mini" v-show="showEdit" @click="exeduRevise(exedu)">修改</el-button>
      </div>  
      <table border="1px" cellspacing="0" cellpadding="0" class="table" v-show="showbutton">
        <tr>
          <td bgcolor="#90D0FC">学历类型</td>
          <td><el-input v-model="exedu.edu_type" placeholder="请输入内容"></el-input>
          </td>
          <td bgcolor="#90D0FC">毕业院校</td>
          <td><el-input v-model="exedu.graduated_sch" placeholder="请输入内容"></el-input>
          </td>
          <td bgcolor="#90D0FC">专业</td>
          <td><el-input v-model="exedu.major" placeholder="请输入内容"></el-input>
          </td>
          <td bgcolor="#90D0FC">毕业时间</td>
          <td>
            <el-date-picker
            v-model="exedu.graduated_time"
            type="date"
            placeholder="选择日期"
            value-format="yyyy-MM-dd"
            >
            </el-date-picker></td>
          <td bgcolor="#90D0FC">学制</td>
          <td>
            <el-select v-model="exedu.edu_system" placeholder="请选择">
              <el-option value="3"></el-option>
              <el-option value="4"></el-option>
            </el-select>
          </td>
        </tr>
        <tr>
          <td bgcolor="#90D0FC">学位</td>
          <td>
            <el-select v-model="exedu.degree" placeholder="请选择">
              <el-option
              v-for="item in degreeAll"
              :key="item.value"
              :label="item.label"
              :value="item.value">
              </el-option>
            </el-select>
          </td>
          <td bgcolor="#90D0FC">学位授予时间</td>
          <td>
            <el-date-picker
            v-model="exedu.degree_time"
            type="date"
            placeholder="选择日期"
            value-format="yyyy-MM-dd">
            </el-date-picker>
          </td>
          <td bgcolor="#90D0FC">授予学校</td>
          <td><el-input v-model="exedu.degree_sch" placeholder="请输入内容"></el-input></td>
          <td bgcolor="#90D0FC">授予学校办学层次</td>
          <td>
            <el-select v-model="exedu.degree_sch_level" placeholder="请选择">
              <el-option value="专科院校"></el-option>
              <el-option value="本科院校"></el-option>
            </el-select>
          </td>
          <td bgcolor="#90D0FC">授予学校性质</td>
          <td>
            <el-select v-model="exedu.degree_sch_nature" placeholder="请选择">
              <el-option value="公办"></el-option>
              <el-option value="民办"></el-option>
            </el-select>
          </td>
        </tr>
      </table>
      <h1 class="item">我的教育经历</h1>
        <el-button class="item" @click="exedu_showTable()">添加教育经历</el-button>
      <el-table
      :data="exedutableData"
      style="width: 100%">
      <el-table-column
      prop="edu_type"
      label="学历类型"
      width="180">
      </el-table-column>
      <el-table-column
      prop="graduated_sch"
      label="毕业院校"
      width="180">
      </el-table-column>
      <el-table-column
      prop="major"
      label="专业">
      </el-table-column>
      <el-table-column
      prop="graduated_time"
      label="毕业时间">
      </el-table-column>
      <el-table-column
      prop="edu_system"
      label="学制">
      </el-table-column>
      <el-table-column
      prop="degree"
      label="学位">
      </el-table-column>
      <el-table-column
      prop="degree_time"
      label="学位授予时间">
      </el-table-column>
      <el-table-column
      prop="degree_sch"
      label="授予学校">
      </el-table-column>
      <el-table-column
      prop="degree_sch_level"
      label="授予学校办学层次">
      </el-table-column>
      <el-table-column
      prop="degree_sch_nature"
      label="授予学校性质">
      </el-table-column>
      <el-table-column label="操作">
        <template slot-scope="scope">
          <el-button
          size="mini"
          @click="exedu_handleEdit(scope.row)">修改</el-button>
          <el-button
          size="mini"
          type="danger"
          @click="exedu_delete(scope.row)">删除
          </el-button>
        </template>
      </el-table-column>
    </el-table>
    </el-tab-pane>
    <el-tab-pane label="培训经历" name="fourth">
      <div class="button" v-show="showbutton">
        <el-button type="success" size="mini" v-show="showEdit==false" @click="submitextrain(extrain)">保存</el-button>
        <el-button type="success" size="mini" v-show="showEdit" @click="extrainRevise(extrain)">修改</el-button>
      </div> 
      <table border="1px" cellspacing="0" cellpadding="0" class="table" v-show="showbutton">
        <tr>
          <td bgcolor="#90D0FC">培训名称</td>
          <td>
            <el-input v-model="extrain.traindata_name" placeholder="请输入内容"></el-input>
          </td>
          <td bgcolor="#90D0FC">组织单位</td>
          <td> 
            <el-input v-model="extrain.company" placeholder="请输入内容"></el-input>
          </td>
          <td bgcolor="#90D0FC">培训地点</td>
          <td><el-input v-model="extrain.traindata_address" placeholder="请输入内容"></el-input>
          </td>
          <td bgcolor="#90D0FC">开始时间</td>
          <td>
            <el-date-picker
            v-model="extrain.start_time"
            type="date"
            placeholder="选择日期"
            value-format="yyyy-MM-dd">
            </el-date-picker>    
          </td>
          <td bgcolor="#90D0FC">结束时间</td>
          <td>
            <el-date-picker
            v-model="extrain.end_time"
            type="date"
            placeholder="选择日期"
            value-format="yyyy-MM-dd">
            </el-date-picker>
          </td>
          <td bgcolor="#90D0FC">培训级别</td>
          <td>
            <el-select v-model="extrain.traindata_level" placeholder="请选择">
              <el-option value="校级">校级</el-option>
              <el-option value="省级">省级</el-option>
              <el-option value="国家级">国家级</el-option>
            </el-select>
          </td>
           <td bgcolor="#90D0FC">培训期数</td>
           <td><el-input v-model="extrain.issue" placeholder="请输入内容"></el-input></td>
        </tr>
      </table>
      <h1 class="item">我的培训经历</h1>
        <el-button class="item" @click="extrain_showTable()">添加培训经历</el-button>
      <el-table
      :data="extraintableData"
      style="width: 100%">
      <el-table-column
        prop="traindata_name"
        label="培训名称"
        width="180">
      </el-table-column>
      <el-table-column
        prop="company"
        label="组织单位"
        width="180">
      </el-table-column>
      <el-table-column
        prop="traindata_address"
        label="培训地点">
      </el-table-column>
      <el-table-column
        prop="start_time"
        label="开始时间">
      </el-table-column>
      <el-table-column
        prop="end_time"
        label="结束时间">
      </el-table-column>
      <el-table-column
        prop="traindata_level"
        label="培训级别">
      </el-table-column>
       <el-table-column
        prop="issue"
        label="培训级别">
      </el-table-column>
      <el-table-column label="操作">
        <template slot-scope="scope">
          <el-button
          size="mini"
          @click="extrain_handleEdit(scope.row)">修改</el-button>
          <el-button
          size="mini"
          type="danger"
          @click="extrain_delete(scope.row)">删除
          </el-button>
        </template>
      </el-table-column>
    </el-table>
    </el-tab-pane>
    <el-tab-pane label="科研情况" name="fifth">
      <el-tabs v-model="tabName" type="card" @tab-click="handle_item">
        <el-tab-pane label="已有项目" name="one">
          <div class="button" v-show="showbutton">
            <el-button type="success" size="mini" v-show="showEdit==false" @click="submitexproject(exproject)">保存</el-button>
            <el-button type="success" size="mini" v-show="showEdit" @click="exprojectRevise(exproject)">修改</el-button>
          </div>  
          <table border="1px" cellspacing="0" cellpadding="0" class="table" v-show="showbutton">
            <tr>
              <td bgcolor="#90D0FC">项目编号</td>
              <td><el-input v-model="exproject.project_id"></el-input></td>
              <td bgcolor="#90D0FC">项目名称</td>
              <td><el-input v-model="exproject.project_name"></el-input></td>
              <td bgcolor="#90D0FC">项目类型</td>
              <td><el-input v-model="exproject.project_type"></el-input></td>
              <td bgcolor="#90D0FC">项目等级</td>
              <td><el-input v-model="exproject.project_level"></el-input></td>
            </tr>
          </table>
          <h1 class="item">我的已有项目</h1>
            <el-button class="item" @click="exproject_showTable()">添加项目</el-button>
          <el-table
          :data="exprojecttableData"
          style="width: 100%">
            <el-table-column
            prop="project_id"
            label="项目编号">
            </el-table-column>
            <el-table-column
            prop="project_name"
            label="项目名称">
            </el-table-column>
            <el-table-column
            prop="project_level"
            label="项目等级">
            </el-table-column>
            <el-table-column
            prop="project_level"
            label="项目等级">
            </el-table-column>
            <el-table-column label="操作">
              <template slot-scope="scope">
                <el-button
                size="mini"
                @click="exproject_handleEdit(scope.row)">修改
                </el-button>
                <el-button
                size="mini"
                type="danger"
                @click="exproject_delete(scope.row)">删除
                </el-button>
              </template>
            </el-table-column>
          </el-table>   
        </el-tab-pane>
        <el-tab-pane label="已有成果" name="two">
          <div class="button" v-show="showbutton">
            <el-button type="success" size="mini" v-show="showEdit==false" @click="submitexachievement(exachievement)">保存</el-button>
            <el-button type="success" size="mini" v-show="showEdit" @click="exachievementRevise(exachievement)">修改</el-button>
          </div>
          <table border="1px" cellspacing="0" cellpadding="0" class="table" v-show="showbutton">
            <tr>
              <td bgcolor="#90D0FC">成果名称</td>
              <td><el-input v-model="exachievement.achievement_name"></el-input></td>
              <td bgcolor="#90D0FC">出版单位</td>
              <td><el-input v-model="exachievement.publish_company"></el-input></td>
              <td bgcolor="#90D0FC">出版时间</td>
              <td>
                <el-date-picker
                  v-model="exachievement.publish_time"
                  type="date"
                  placeholder="选择日期"
                  value-format="yyyy-MM-dd">
                </el-date-picker>
              </td>
            </tr>
          </table>
          <h1 class="item">我的已有成果</h1>
          <el-button class="item" @click="exachievement_showTable()">添加成果</el-button>
          <el-table
          :data="exachievementtableData"
          style="width: 100%">
            <el-table-column
            prop="achievement_name"
            label="成果名称"></el-table-column>
           <el-table-column
            prop="publish_company"
            label="出版单位"></el-table-column>
            <el-table-column
            prop="publish_time"
            label="出版时间"
            ></el-table-column>
            <el-table-column label="操作">
              <template slot-scope="scope">
                <el-button
                size="mini"
                @click="exachievement_handleEdit(scope.row)">修改
                </el-button>
                <el-button
                size="mini"
                type="danger"
                @click="exachievement_delete(scope.row)">删除
                </el-button>
              </template>
            </el-table-column>
          </el-table>   
        </el-tab-pane>
    </el-tabs>
    </el-tab-pane>
    <el-tab-pane label="荣誉奖项" name="sixth" >
      <div class="button" v-show="showbutton">
        <el-button type="success" size="mini" v-show="showEdit==false" @click="submitexhonor(exhonor)">保存</el-button>
        <el-button type="success" size="mini" v-show="showEdit" @click="exhonorRevise(exhonor)">修改</el-button>
      </div> 
          <table border="1px" cellspacing="0" cellpadding="0" class="table" v-show="showbutton">
            <tr>
              <td bgcolor="#90D0FC">获奖名称</td>
              <td><el-input v-model="exhonor.honor_name"></el-input></td>
              <td bgcolor="#90D0FC">获奖时间</td>
              <td>
                <el-date-picker
                  v-model="exhonor.honor_time"
                  type="date"
                  placeholder="选择日期"
                  value-format="yyyy-MM-dd">
                </el-date-picker>
              </td>
              <td bgcolor="#90D0FC">授予单位</td>
              <td><el-input v-model="exhonor.honor_company"></el-input></td>
            </tr>
          </table>
          <h1 class="item">我的荣誉奖项</h1>
            <el-button class="item" @click="exhonor_showTable()">添加荣誉奖项</el-button>
          <el-table
          :data="exhonortableData"
          style="width:100% ">
            <el-table-column
            prop="honor_name"
            label="获奖名称"></el-table-column>
           <el-table-column
            prop="honor_time"
            label="获奖时间"></el-table-column>
            <el-table-column
            prop="honor_company"
            label="授予单位"></el-table-column>
            <el-table-column label="操作">
              <template slot-scope="scope">
                <el-button
                size="mini"
                @click="exhonor_handleEdit(scope.row)">修改
                </el-button>
                <el-button
                size="mini"
                type="danger"
                @click="exhonor_delete(scope.row)">删除
                </el-button>
              </template>
            </el-table-column>
          </el-table>   
    </el-tab-pane>
  </el-tabs>
</template>
<style scoped>
.button{
  position: relative;
  display: inline-block;
  right: 1px;
  padding: 10px;
}
.table td{
  width: 200px;
  height: 50px;
  text-align: center;
}
.item{
  position: relative;
  display: inline-block;
  margin-left: 10px;
}
input{
    border: none;
    overflow: hidden;
    height: 100%;
    width: 100%;
    text-align: center;
    background-color:#FFFFFF;
}
</style>
<script>
import http from './../../../../assets/js/http.js'
  export default {
    data() {
      return {
        userInfo:Lockr.get('userInfo'),
        activeName:'first',
        tabName:'one',
        // btnShow:true,//显示添加个人经历按钮
        showEdit:false,
        id:'',//个人身份标识
        politicsList:[
        {
          value:'中共党员',
          label: '中共党员'
        },{
          value:'中共预备党员',
          label: '中共预备党员'
        },{
          value:'共青团员',
          label: '共青团员'
        },{
          value:'群众',
          label: '群众'
        },{
          value:'民革党员',
           label: '民革党员'
        },{
          value:'民盟盟员',
          label:'民盟盟员'
        },{
          value:'民建会员',
          label:'民建会员'
        },{
          value:'民进会员',
          label:'民进会员'
        },{
          value:'农工党党员',
          label:'农工党党员'
        },{
          value:'致公党党员',
          label:'致公党党员'
        },{
          value:'九三学社社员',
          label:'九三学社社员'
        },{
          value:'台盟盟员',
          label:'台盟盟员'
        },{
          value:'无党派人士',
          label:'无党派人士'
        },{
          value:'其他',
          label:'其他'
        }],
        eduAll:[
        {
          value:'博士研究生',
          label:'博士研究生'
        },{
          value:'硕士研究生',
          label:'硕士研究生'
        },{
          value:'大学本科',
          label:'大学本科'
        },{
          value:'大学专科',
          label:'大学专科'
        },{
          value:'高中',
          label:'高中'
        },{
          value:'其他',
          label:'其他'
        }],
        degreeAll:[{
          value:'博士',
          label:'博士'
        },{
          value:'硕士',
          label:'硕士'
        },{
          value:'学士',
          label:'学士'
        },{
          value:'其他',
          label:'其他'
        }],
        formInfo:{
          name:'',
          sex:'',
          nation:'',
          birth:'',
          edu:'',
          degree:'',
          politics:'',
          preoccupation:'',
          majoroccupation:'',
          majortime:'',
          sch:'',
          jobrank:'',
          idnumber:'',
          address:'',
          postalcode:'',
          office:'',
          phone:'',
          qq:'',
          email:'',
          fax:''
        },
        //如果把审核状态放在form中，form数据通过网络获取，会有延迟，所以会看到审核状态闪现
        info_status:'1',
        exwork:{
          id:'', //每个工作经历标识
          work:'',
          preoccupation:'',
          start_time:'',
          end_time:''
        },
        reviseBtn: false, //显示个人信息修改按钮
        exworktableData:[],
        exedu:{
          id:'',//每个教育经历标识
          edu_type:'',
          graduated_sch:'',
          major:'',
          graduated_time:'',
          edu_system:'',
          degree:'',
          degree_time:'',
          degree_sch:'',
          degree_sch_level:'',
          degree_sch_nature:''
        },
        exedutableData:[],
        extrain:{
          id:'',
          traindata_name:'',
          company:'',
          traindata_address:'',
          start_time:'',
          end_time:'',
          traindata_level:'',
          issue:''
        },
        extraintableData:[],
        exproject:{
          id:'',
          project_id:'',
          project_name:'',
          project_level:'',
          project_type:''
        },
        exprojecttableData:[],
        exachievement:{
          id:'',
          achievement_name:'',
          publish_company:'',
          publish_time:''
        },
        exachievementtableData:[],
        exhonor:{
          id:'',
          honor_name:'',
          honor_time:'',
          honor_company:''
        },
        exhonortableData:[],
        showbutton:false//显示个人经历表格按钮
      };
    },
    methods: {
       // tab被选中时触发
      handleClick(tab, event) {
        // console.log(tab, event);
        if(tab.name == 'second'){
          // 触发‘配置管理’事件
          this.second();
        }else if(tab.name == 'first'){
          // 触发‘基本信息’事件
          this.first();
        }else if(tab.name == 'third'){
          //触发‘教育经历’事件
          this.third();
        }else if(tab.name == 'fourth'){
          //触发‘培训经历’事件
          this.fourth();
        }else if(tab.name == 'fifth'){
          //触发‘科研经历’事件
          this.one();
          this.two();
        }else{
          //触发‘荣誉奖项’事件
          this.sixth();
        }
      },
      handle_item(tab, event){
        if(tab.name == 'one'){
          //触发‘科研情况’事件里面“已有项目”
          this.one();
        }else{
           //触发‘科研情况’事件里面“已有成果”
          //  console.log("触发‘科研情况’事件里面“已有成果”")
          this.two();
        }
      },
      one(){
        let data = {
          train_id: this.id
        }
        this.apiPost('admin/Exproject/ExprojectList',data).then((res) =>{
          this.handelResponse(res,(data) =>{
            // console.log(res.data)
            this.exprojecttableData = res.data
          })
        })
      },
      two(){
        let data = {
          train_id: this.id
        }
        this.apiPost('admin/Exachievement/ExachievementList',data).then((res) =>{
          this.handelResponse(res,(data) =>{
            // console.log(res.data)
            this.exachievementtableData = res.data
          })
        })
      },
      /**
       * 触发‘基本信息’事件
         显示个人信息数据库数据
       */
      first(){
        // console.log(this.userInfo)
        let data = {
          name:this.userInfo.realname,
          idnumber:this.userInfo.username
        }
        // this.formInfo.name = this.userInfo.realname
        // this.formInfo.idnumber = this.userInfo.username
        this.apiPost('admin/Train/TrainAll',data).then((res) =>{
          this.handelResponse(res,(data) =>{
            console.log(res.data[0])
              this.reviseBtn = true
              this.id = res.data[0].id
              this.formInfo = data[0]
              this.info_status = data[0].status
            // console.log(res.data[0])
          })
        })
      },
      /**
       * 触发‘工作经历’事件
         获取工作经历列表
       */
      second(){
        let data = {
          train_id: this.id
        }
        this.apiPost('admin/Exwork/ExworkList',data).then((res) =>{
          this.handelResponse(res,(data) =>{
            console.log(res.data)
            this.exworktableData = res.data
          })
        })
      },
      third(){
        let data = {
          train_id: this.id
        }
        this.apiPost('admin/Exedu/ExeduList',data).then((res) =>{
          this.handelResponse(res,(data) =>{
            // console.log(res.data)
            this.exedutableData = res.data
          })
        }) 
      },
      fourth(){
        let data = {
          train_id: this.id
        }
        this.apiPost('admin/Extrain/ExtrainList',data).then((res) =>{
          this.handelResponse(res,(data) =>{
            // console.log(res.data)
            this.extraintableData = res.data
          })
        })   
      },
      sixth(){
         let data = {
          train_id: this.id
        }
        this.apiPost('admin/Exhonor/ExhonorList',data).then((res) =>{
          this.handelResponse(res,(data) =>{
            // console.log(res.data)
            this.exhonortableData = res.data
          })
        })   
      },
      // 点击修改按钮，显示修改表格
      exwork_handleEdit(row){
        // console.log(row)
        this.showbutton = true;
        this.showEdit = true;
        this.exwork = row;
      },
      exedu_handleEdit(row){
        // console.log(row)
        this.showbutton = true;
        this.showEdit = true;
        this.exedu = row;
      },
      extrain_handleEdit(row){
        this.showbutton = true;
        this.showEdit = true;
        this.extrain = row;  
      },
      exproject_handleEdit(row){
        this.showbutton = true;
        this.showEdit = true;
        this.exproject = row;  
      },
      exachievement_handleEdit(row){
        this.showbutton = true;
        this.showEdit = true;
        this.exachievement = row;  
      },
      exhonor_handleEdit(row){
        this.showbutton = true;
        this.showEdit = true;
        this.exhonor = row;  
      },
      
      //点击添加按钮，显示表格
      exwork_showTable(){
        this.showbutton = true;
        this.showEdit = false;
        this.exwork={};
      },
      exedu_showTable(){
        this.showbutton = true;
        this.showEdit = false;
        this.exedu={};
      },
      extrain_showTable(){
        this.showbutton = true;
        this.showEdit = false;
        this.extrain={};
      },
      exproject_showTable(){
        this.showbutton = true;
        this.showEdit = false;
        this.exproject={};  
      },
      exachievement_showTable(){
        this.showbutton = true;
        this.showEdit = false;
        this.exachievement={};    
      },
      exhonor_showTable(){
        this.showbutton = true;
        this.showEdit = false;
        this.exhonor={};    
      },
      // <!--修改个人信息-->
      reviseinfo(formInfo){
        // <!-- 个人信息验证 -->
        var checkResult = this.checkList(this.formInfo,
          [{
            'name':'idnumber',
            'reg':['notnull']
          },{
            'name':'postalcode',
            'reg':['notnull']
          },{
            'name':'office',
            'reg':['notnull']
          },{
            'name':'phone',
            'reg':['notnull']
          },{
            'name':'qq',
            'reg':['notnull']
          },{
            'name':'email',
            'reg':['notnull']
          },{
            'name':'sex',
            'reg':['notnull']
          },{
            'name':'nation',
            'reg':['notnull']
          },{
            'name':'birth',
            'reg':['notnull']
          },{
            'name':'degree',
            'reg':['notnull']
          },{
            'name':'politics',
            'reg':['notnull']
          },{
            'name':'preoccupation',
            'reg':['notnull']
          },{
            'name':'majoroccupation',
            'reg':['notnull']
          },{
            'name':'majortime',
            'reg':['notnull']
          },{
            'name':'sch',
            'reg':['notnull']
          },{
            'name':'jobrank',
            'reg':['notnull']
          },{
            'name':'address',
            'reg':['notnull']
          }
          ])
          console.log(checkResult)
        if(_g.j2s(checkResult) === '{}'){
          let data = this.formInfo;
          this.apiPost('admin/Train/TrainRevise',data).then((res) =>{
            this.handelResponse(res,(data) =>{
                _g.toastMsg('success','个人信息修改成功！')
              setTimeout(() => {
                this.first()
                  // this.activeName = 'second'
                }, 1000)
            })
          }) 
        } 
      },
      // <!--新增工作经历-->
      submitexwork(exwork){ 
       var checkResult = this.checkList(this.exwork,
          [{
            'name':'work',
            'reg':['notnull']
          },{
            'name':'preoccupation',
            'reg':['notnull']
          },{
            'name':'start_time',
            'reg':['notnull']
          },{
            'name':'end_time',
            'reg':['notnull']
          }
          ])
        if(_g.j2s(checkResult) === '{}'){
           let data = {
          train_id:this.id,
          name:this.formInfo.name,
          work:this.exwork.work,
          preoccupation:this.exwork.preoccupation,
          start_time:this.exwork.start_time,
          end_time:this.exwork.end_time
          }
          this.apiPost('admin/Exwork/ExworkWrite',data).then((res) =>{
            this.handelResponse(res,(data) =>{
              if(res.code == 200){
                _g.toastMsg('success','添加成功！')
                this.second() 
                this.exwork = {} 
              }else{
                _g.toastMsg('error','添加失败！')
              }
              this.exwork = {}
            })
          }) 
        }
      },
      //修改个人经历
      exworkRevise(exwork){
        // console.log(this.exwork)
        let data = {
          id:this.exwork.id,
          work:this.exwork.work,
          preoccupation:this.exwork.preoccupation,
          start_time:this.exwork.start_time,
          end_time:this.exwork.end_time 
        }
        this.apiPost('admin/Exwork/ExworkRevise',data).then((res) =>{
          this.handelResponse(res,(data) =>{
            if(res.code == 200){
              _g.toastMsg('success','修改成功！')
              this.exwork = {}
            }else{
              _g.toastMsg('error','修改失败！')
            }
            this.second()
          })
        }) 
      },
      //删除个人经历
      exwork_delete(item) {
        // console.log(item)
        let data = {
            id: item.id
        }
        this.apiPost('admin/Exwork/ExworkDelete', data).then((res) => {
            this.handelResponse(res, (data) => {
              // console.log(res)
              _g.toastMsg('success', res.data)
              this.second()
            })
          })
      },
      //新增教育经历
      submitexedu(exedu){
         var checkResult = this.checkList(this.exedu,
          [{
            'name':'degree_sch_nature',
            'reg':['notnull']
          },{
            'name':'edu_type',
            'reg':['notnull']
          },{
            'name':'graduated_sch',
            'reg':['notnull']
          },{
            'name':'major',
            'reg':['notnull']
          },{
            'name':'graduated_time',
            'reg':['notnull']
          },{
            'name':'edu_system',
            'reg':['notnull']
          },{
            'name':'degree',
            'reg':['notnull']
          },{
            'name':'degree_time',
            'reg':['notnull']
          },{
            'name':'degree_sch',
            'reg':['notnull']
          },{
            'name':'degree_sch_level',
            'reg':['notnull']
          }
          ])
          // console.log(checkResult)
        if(_g.j2s(checkResult) === '{}'){
          let data = {
            train_id:this.id,
            name:this.formInfo.name,
            degree_sch_nature:this.exedu.degree_sch_nature,
            edu_type:this.exedu.edu_type,
            graduated_sch:this.exedu.graduated_sch,
            major:this.exedu.major,
            graduated_time:this.exedu.graduated_time,
            edu_system:this.exedu.edu_system,
            degree:this.exedu.degree,
            degree_time:this.exedu.degree_time,
            degree_sch:this.exedu.degree_sch,
            degree_sch_level:this.exedu.degree_sch_level
          }
        // console.log(data)    
          this.apiPost('admin/Exedu/ExeduWrite',data).then((res) =>{
            this.handelResponse(res,(data) =>{
              if(res.code == 200){
                _g.toastMsg('success','添加成功！')
                this.third() 
                this.exedu = {} 
              }else{
                _g.toastMsg('error','添加失败！')
              }
            })
          }) 
        }
      },
      //修改教育经历
      exeduRevise(exedu){
        // console.log(this.exedu)
        let data = this.exedu
        this.apiPost('admin/Exedu/ExeduRevise',data).then((res) =>{
          this.handelResponse(res,(data) =>{
            // console.log(res.data)
            if(res.code == 200){
              _g.toastMsg('success','修改成功！')
              this.exedu = {}
            }else{
              _g.toastMsg('error','修改失败！')
            }
            this.third()
          })
        }) 
      },
      //删除教育经历
      exedu_delete(item) {
        // console.log(item)
        let data = {
            id: item.id
        }
        this.apiPost('admin/Exedu/ExeduDelete', data).then((res) => {
            this.handelResponse(res, (data) => {
              // console.log(res)
              _g.toastMsg('success', res.data)
              this.third()
            })
          })
      },
      //新增培训经历
      submitextrain(extrain){
        var checkResult = this.checkList(this.extrain,
          [{
            'name':'traindata_name',
            'reg':['notnull']
          },{
            'name':'company',
            'reg':['notnull']
          },{
            'name':'traindata_address',
            'reg':['notnull']
          },{
            'name':'end_time',
            'reg':['notnull']
          },{
            'name':'start_time',
            'reg':['notnull']
          },{
            'name':'traindata_level',
            'reg':['notnull']
          },{
            'name':'issue',
            'reg':['notnull']
          }
          ])
        if(_g.j2s(checkResult) === '{}'){
          let data = {
            train_id:this.id,
            name:this.formInfo.name,
            traindata_name:this.extrain.traindata_name,
            company:this.extrain.company,
            traindata_address:this.extrain.traindata_address,
            start_time:this.extrain.start_time,
            end_time:this.extrain.end_time,
            traindata_level:this.extrain.traindata_level,
            issue:this.extrain.issue
          }
        // console.log(data)    
          this.apiPost('admin/Extrain/ExtrainWrite',data).then((res) =>{
            this.handelResponse(res,(data) =>{
              if(res.code == 200){
                _g.toastMsg('success','添加成功！')
                this.fourth()
                this.extrain = {}  
              }else{
                _g.toastMsg('error','添加失败！')
              }
            })
          }) 
        }
      },
      //修改培训经历
      extrainRevise(extrain){
        // console.log(this.exedu)
        let data = this.extrain
        this.apiPost('admin/Extrain/ExtrainRevise',data).then((res) =>{
          this.handelResponse(res,(data) =>{
            if(res.code == 200){
              _g.toastMsg('success','修改成功！')
              this.extrain = {}
            }else{
              _g.toastMsg('error','修改失败！')
            }
            this.fourth()
          })
        }) 
      },
       //删除培训经历
      extrain_delete(item) {
        // console.log(item)
        let data = {
            id: item.id
        }
        this.apiPost('admin/Extrain/ExtrainDelete', data).then((res) => {
            this.handelResponse(res, (data) => {
              // console.log(res)
              _g.toastMsg('success', res.data)
              this.fourth()
            })
          })
      },
      //新增已有项目
      submitexproject(exproject){
        var checkResult = this.checkList(this.exproject,
          [{
            'name':'project_id',
            'reg':['notnull']
          },{
            'name':'project_name',
            'reg':['notnull']
          },{
            'name':'project_level',
            'reg':['notnull']
          },{
            'name':'project_type',
            'reg':['notnull']
          }
          ])
        if(_g.j2s(checkResult) === '{}'){
          let data = {
            train_id:this.id,
            name:this.formInfo.name,
            project_id:this.exproject.project_id,
            project_name:this.exproject.project_name,
            project_level:this.exproject.project_level,
            project_type:this.exproject.project_type
          }
        // console.log(data)    
          this.apiPost('admin/Exproject/ExprojectWrite',data).then((res) =>{
            this.handelResponse(res,(data) =>{
              if(res.code == 200){
                _g.toastMsg('success','添加成功！')
                this.one() 
                this.exproject = {}
              }else{
                _g.toastMsg('error','添加失败！')
              }
            })
          })
        }  
      },
      //修改已有项目
      exprojectRevise(exproject){
        let data = this.exproject
        this.apiPost('admin/Exproject/ExprojectRevise',data).then((res) =>{
          this.handelResponse(res,(data) =>{
            if(res.code == 200){
              _g.toastMsg('success','修改成功！')
              this.exproject = {}
            }else{
              _g.toastMsg('error','修改失败！')
            }
            this.one()
          })
        }) 
      },
         //删除已有项目
      exproject_delete(item) {
        // console.log(item)
        let data = {
            id: item.id
        }
        this.apiPost('admin/Exproject/ExprojectDelete', data).then((res) => {
            this.handelResponse(res, (data) => {
              // console.log(res)
              _g.toastMsg('success', res.data)
              this.one()
            })
          })
      },
      //新增已有成果
      submitexachievement(exachievement){
        var checkResult = this.checkList(this.exachievement,
          [{
            'name':'achievement_name',
            'reg':['notnull']
          },{
            'name':'publish_company',
            'reg':['notnull']
          },{
            'name':'publish_time',
            'reg':['notnull']
          }
          ])
          // console.log(checkResult)
        if(_g.j2s(checkResult) === '{}'){
          let data = {
            train_id:this.id,
            name:this.formInfo.name,
            achievement_name:this.exachievement.achievement_name,
            publish_company:this.exachievement.publish_company,
            publish_time:this.exachievement.publish_time
          }    
          this.apiPost('admin/Exachievement/ExachievementWrite',data).then((res) =>{
            this.handelResponse(res,(data) =>{
              if(res.code == 200){
                _g.toastMsg('success','添加成功！')
                this.two()
                this.exachievement = {}  
              }else{
                _g.toastMsg('error','添加失败！')
              }
            })
          })
        }  
      },
      //修改已有成果
      exachievementRevise(exachievement){
        let data = this.exachievement
        this.apiPost('admin/Exachievement/ExachievementRevise',data).then((res) =>{
          this.handelResponse(res,(data) =>{
            if(res.code == 200){
              _g.toastMsg('success','修改成功！')
              this.exachievement = {}
            }else{
              _g.toastMsg('error','修改失败！')
            }
            this.two()
          })
        }) 
      },
         //删除已有成果
      exachievement_delete(item) {
        // console.log(item)
        let data = {
            id: item.id
        }
        this.apiPost('admin/Exachievement/ExachievementDelete', data).then((res) => {
            this.handelResponse(res, (data) => {
              // console.log(res)
              _g.toastMsg('success', res.data)
              this.two()
            })
          })
      },
      //新增荣誉奖项
      submitexhonor(exhonor){
        var checkResult = this.checkList(this.exhonor,
          [{
            'name':'honor_name',
            'reg':['notnull']
          },{
            'name':'honor_time',
            'reg':['notnull']
          },{
            'name':'honor_company',
            'reg':['notnull']
          }
          ])
        if(_g.j2s(checkResult) === '{}'){
          let data = {
            train_id:this.id,
            name:this.formInfo.name,
            honor_name:this.exhonor.honor_name,
            honor_time:this.exhonor.honor_time,
            honor_company:this.exhonor.honor_company
          }
        // console.log(data)    
          this.apiPost('admin/Exhonor/ExhonorWrite',data).then((res) =>{
            this.handelResponse(res,(data) =>{
              if(res.code == 200){
                _g.toastMsg('success','添加成功！')
                this.sixth()  
              }else{
                _g.toastMsg('error','添加失败！')
              }
              this.exhonor = {}
            })
          })
        }  
      },
      //修改荣誉奖项
      exhonorRevise(exhonor){
        let data = this.exhonor
        this.apiPost('admin/Exhonor/ExhonorRevise',data).then((res) =>{
          this.handelResponse(res,(data) =>{
            if(res.code == 200){
              _g.toastMsg('success','修改成功！')
              this.exhonor = {}
            }else{
              _g.toastMsg('error','修改失败！')
            }
            this.sixth()
          })
        }) 
      },
         //删除荣誉奖项
      exhonor_delete(item) {
        let data = {
            id: item.id
        }
        this.apiPost('admin/Exhonor/ExhonorDelete', data).then((res) => {
            this.handelResponse(res, (data) => {
              // console.log(res)
              _g.toastMsg('success', res.data)
              this.sixth()
            })
          })
      }
      
    },
    
    created(){
      _g.closeGlobalLoading()
      this.first()
      this.one()
      // this.getInfo()
      // this.getInfoList()
      // this.getworkList()   
    },
    components: {
    },
    mixins: [http]
  }
</script>

